package win.larryzeal.logdemo.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by 张少昆 on 2016/12/31.
 */
@Controller
public class ForwardJspController {
	private static final Logger logger = LoggerFactory.getLogger(ForwardJspController.class);

	@RequestMapping( "/views/{file:.+}" )
	public String jsp1(@PathVariable( "file" ) String file){
		logger.info("@RequestMapping( \"/views/{file:.+}.jsp\" ) is working!");
		return "/" + file;
	}

	@RequestMapping( "/views/{dir}/{file:.+}" )
	public String jsp2(@PathVariable( "dir" ) String dir, @PathVariable( "file" ) String file){
		logger.info("@RequestMapping( \"/views/{dir}/{file:.+}.jsp\" ) is working!");
		return "/" + dir + "/" + file;
	}
}
